//用户接口管理模块

import { request } from "/@/middleware";
import type { User } from "./type";

enum Api {
  user = "/user",
  login = "/login",
  menu = "/menu",
}
export const user = {
  login(data: User) {
    return request?.post<User>(Api.login, data);
  },
  getUserInfo() {
    return request?.get(Api.user + "/all");
  },
  deleteUser(id: number) {
    return request?.delete(Api.user + "/" + id);
  },
  loadMenu() {
    return request?.get(Api.menu);
  },
  addUser(data: User) {
    return request?.post(Api.user, data);
  },
  updateUser(data: User) {
    return request?.put(Api.user, data);
  },
};
